package com.supply.dl.http;

import android.content.Context;

import com.supply.dl.app.ApiService;
import com.supply.dl.app.http.*;
import com.supply.dl.bean.*;
import com.supply.dl.bean.request.*;
import com.supply.dl.utils.StorageUtil;
import com.supply.dl.utils.StringUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import java.util.List;

/**
 * Created by ${qianzhihe} on 2018/4/26.
 * HTTP网络请求管理类
 */

public class HttpManger {

    Context mContext;
    HttpResponseCallBackListener mHttpResponseCallBackListener;
//    LoginResponseCallBackListener loginResponseCallBackListener;

    static volatile HttpManger httpManger;

    public static final String PAGE_SIZE = "10"; //默认分页数量

    String token;

    public static HttpManger getInstance() {
        if (null == httpManger) {
            synchronized (HttpManger.class) {
                if (null == httpManger) {
                    httpManger = new HttpManger();
                }
            }
        }
        return httpManger;
    }

    public void setContext(Context mContext) {
        this.mContext = mContext.getApplicationContext();
        token = StorageUtil.getUserToken(mContext.getApplicationContext());
    }

    /**
     * 入库定位列表
     *
     * @param inBoundLocationReq 请求参数对象
     * @param pageNum 页码
     * @return
     */
    public void getInboundLocationData(InBoundLocationReq inBoundLocationReq, String pageNum) {
        ApiService api = HttpMethod.getInstance().create(ApiService.class);
        api.getInboundLocation(inBoundLocationReq, pageNum, PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> listBaseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(listBaseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 出库定位列表
     *
     * @param inBoundLocationReq 请求参数对象
     * @return
     */
    public void getOutboundLocationData(InBoundLocationReq inBoundLocationReq, String pageNum) {
        ApiService api = HttpMethod.getInstance().create(ApiService.class);
        api.getOutboundLocation(inBoundLocationReq, pageNum, PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> listBaseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(listBaseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单入库定位详情
     *
     * @param orderId
     * @param noticeOrderId
     */
    public void getPositionInBoundDetail(String orderId, String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        /**
         * noticeOrderId为空，使用orderId作为参数
         * noticeOrderId非空，使用noticeOrderId作为参数
         */
        if (!StringUtils.isEmpty(noticeOrderId)) {
            mApiService.getPositionInBoundDetailByNoticeOrderId(noticeOrderId)
                    .compose(RxSchedulers.<BaseInfo<PositionDetailBean>>compose(mContext)).subscribe(new BaseObserver<PositionDetailBean>() {
                @Override
                public void onSuccess(BaseInfo<PositionDetailBean> positionDetailBeanBaseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(positionDetailBeanBaseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        } else {
            mApiService.getPositionInBoundDetailByOrderId(orderId).compose(RxSchedulers.<BaseInfo<PositionDetailBean>>compose(mContext)).subscribe(new BaseObserver<PositionDetailBean>() {
                @Override
                public void onSuccess(BaseInfo<PositionDetailBean> positionDetailBeanBaseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(positionDetailBeanBaseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        }
    }

    /**
     * 通知单出库定位详情
     *
     * @param orderId
     * @param noticeOrderId
     */
    public void getPositionOutBoundDetail(String orderId, String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        if (!StringUtils.isEmpty(noticeOrderId)) {
            mApiService.getPositionOutBoundDetailByNoticeOrderId(noticeOrderId).compose(RxSchedulers.<BaseInfo<PositionDetailBean>>compose(mContext)).subscribe(new BaseObserver<PositionDetailBean>() {
                @Override
                public void onSuccess(BaseInfo<PositionDetailBean> positionDetailBeanBaseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(positionDetailBeanBaseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        } else {
            mApiService.getPositionOutBoundDetailByOrderId(orderId).compose(RxSchedulers.<BaseInfo<PositionDetailBean>>compose(mContext)).subscribe(new BaseObserver<PositionDetailBean>() {
                @Override
                public void onSuccess(BaseInfo<PositionDetailBean> positionDetailBeanBaseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(positionDetailBeanBaseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        }

    }

    /**
     * 通知单入库列表
     *
     * @param noticeRequest
     */
    public void getNoticeInBoundList(NoticeRequest noticeRequest, String pageNum) {
        ApiService apiService = HttpMethod.getInstance().create(ApiService.class);
        apiService.getNoticeInBoundList(noticeRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单出库列表
     *
     * @param noticeRequest
     */
    public void getNoticeOutBoundList(NoticeRequest noticeRequest, String pageNum) {
        ApiService apiService = HttpMethod.getInstance().create(ApiService.class);
        apiService.getNoticeOutBoundList(noticeRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单入库详情
     *
     * @param noticeOrderId
     */
    public void getNoticeInBoundDetailList(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        PositionDetailReq noticeInBoundDetailReq = new PositionDetailReq();
        noticeInBoundDetailReq.noticeOrderId = StringUtils.isEmpty(noticeOrderId) ? "" : noticeOrderId;
        mApiService.getNoticeInBoundDetailList(noticeOrderId).compose(RxSchedulers.<BaseInfo<NoticeBoundDetailBean>>compose(mContext)).subscribe(new BaseObserver<NoticeBoundDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<NoticeBoundDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单出库详情
     *
     * @param noticeOrderId
     */
    public void getNoticeOutBoundDetailList(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        PositionDetailReq noticeOutBoundDetailReq = new PositionDetailReq();
        noticeOutBoundDetailReq.noticeOrderId = StringUtils.isEmpty(noticeOrderId) ? "" : noticeOrderId;
        mApiService.getNoticeOutBoundDetailList(noticeOrderId).compose(RxSchedulers.<BaseInfo<NoticeBoundDetailBean>>compose(mContext)).subscribe(new BaseObserver<NoticeBoundDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<NoticeBoundDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 获取订单入库列表数据
     *
     * @param orderBoundRequest
     */
    public void getOrderInBoundList(OrderBoundRequest orderBoundRequest, String pageNum) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getOrderInBoundList(orderBoundRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<OrderInAndOutBoundBean>>>compose(mContext)).subscribe(new BaseObserver<List<OrderInAndOutBoundBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<OrderInAndOutBoundBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 获取订单出库列表数据
     *
     * @param orderBoundRequest
     */
    public void getOrderOutBoundList(OrderBoundRequest orderBoundRequest, String pageNum) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getOrderOutBoundList(orderBoundRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<OrderInAndOutBoundBean>>>compose(mContext)).subscribe(new BaseObserver<List<OrderInAndOutBoundBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<OrderInAndOutBoundBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 订单入库详情数据
     *
     * @param orderId
     */
    public void getOrderInBoundDetailData(String orderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        OrderBoundDetailRequest orderBoundDetailRequest = new OrderBoundDetailRequest();
        orderBoundDetailRequest.orderId = StringUtils.isEmpty(orderId) ? "" : orderId;
        mApiService.getOrderInBoundDetailData(orderBoundDetailRequest.orderId).compose(RxSchedulers.<BaseInfo<OrderBoundDetailBean>>compose(mContext)).subscribe(new BaseObserver<OrderBoundDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<OrderBoundDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 订单出库详情数据
     *
     * @param orderId
     */
    public void getOrderOutBoundDetailData(String orderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        OrderBoundDetailRequest orderBoundDetailRequest = new OrderBoundDetailRequest();
        orderBoundDetailRequest.orderId = StringUtils.isEmpty(orderId) ? "" : orderId;
        mApiService.getOrderOutBoundDetailData(orderBoundDetailRequest.orderId).compose(RxSchedulers.<BaseInfo<OrderBoundDetailBean>>compose(mContext)).subscribe(new BaseObserver<OrderBoundDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<OrderBoundDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 收货确认列表
     *
     * @param confirmRequest
     */
    public void getReceivingGoodsConfirmList(ReceivingAndSendGoodsConfirmRequest confirmRequest, String pageNum) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getReceivingGoodsConfirmList(confirmRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 收货确认详情
     *
     * @param noticeOrderId
     */
    public void getReceivingGoodsConfirmDetailList(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getReceivingGoodsConfirmDetailList(noticeOrderId).compose(RxSchedulers.<BaseInfo<ReceivingAndSendGoodsConfirmDetailBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingAndSendGoodsConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingAndSendGoodsConfirmDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 收货确认详情界面过账
     *
     * @param noticeOrderId
     */
    public void receivingGoodsConfirmDetailPostingAccount(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.postingAccountReceivingGoodsConfirm(noticeOrderId).compose(RxSchedulers.<BaseInfo<ReceivingAndSendGoodsConfirmDetailBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingAndSendGoodsConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingAndSendGoodsConfirmDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 发货确认列表
     *
     * @param confirmRequest
     */
    public void getSendGoodsConfirmList(ReceivingAndSendGoodsConfirmRequest confirmRequest, String pageNum) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getSendGoodsConfirmList(confirmRequest, pageNum, HttpManger.PAGE_SIZE).compose(RxSchedulers.<BaseInfo<List<InAndOutBoundLocationBean>>>compose(mContext)).subscribe(new BaseObserver<List<InAndOutBoundLocationBean>>(mContext) {
            @Override
            public void onSuccess(BaseInfo<List<InAndOutBoundLocationBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 发货确认详情
     *
     * @param noticeOrderId
     */
    public void getSendGoodsConfirmDetailList(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getSendGoodsConfirmDetailList(noticeOrderId).compose(RxSchedulers.<BaseInfo<ReceivingAndSendGoodsConfirmDetailBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingAndSendGoodsConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingAndSendGoodsConfirmDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 发货确认详情界面过账
     *
     * @param noticeOrderId
     */
    public void sendGoodsConfirmDetailPostingAccount(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.postingAccountSendGoodsConfirm(noticeOrderId).compose(RxSchedulers.<BaseInfo<ReceivingAndSendGoodsConfirmDetailBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingAndSendGoodsConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingAndSendGoodsConfirmDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单定位详情：
     * 确认定位(通知单未定位)
     * 确认定位(通知单已定位)
     *
     * @param noticeDetailRequest
     */
    public void confirmLocationByNoticeLocationDetailInBound(ConfirmLocationNoticeDetailRequest noticeDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.confirmLocationByNoticeLocationDetailInBound(noticeDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 出库定位：通知单定位详情-确定定位
     * 通知单定位详情：
     * 确认定位(通知单未定位)
     * 确认定位(通知单已定位)
     *
     * @param noticeDetailRequest
     */
    public void confirmLocationByNoticeLocationDetailOutBound(ConfirmLocationNoticeDetailRequest noticeDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.confirmLocationByNoticeLocationDetailOutBound(noticeDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo<BaseInfo> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单定位详情：
     * 删除定位(通知单未定位、通知单已定位)
     *
     * @param ids
     */
    public void deleteLocationList(String ids) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.deleteLocationList(ids).compose(RxSchedulers.<BaseInfo<ReceivingSendGoodsConfirmBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingSendGoodsConfirmBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingSendGoodsConfirmBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 出库定位--定位详情--删除定位
     * 3.7接口：删除定位
     * @param ids
     */
    public void deleteLocationByNoticeLocationDetailOutBound(String ids) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.deleteLocationByNoticeLocationDetailOutBound(ids).compose(RxSchedulers.<BaseInfo<ReceivingSendGoodsConfirmBean>>compose(mContext)).subscribe(new BaseObserver<ReceivingSendGoodsConfirmBean>() {
            @Override
            public void onSuccess(BaseInfo<ReceivingSendGoodsConfirmBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     *  通知单批量定位UI界面：确认定位(通知单批量定位)
     *  2.9接口：wms/app/new/asn/position/batch/confirm
     * @param noticeDetailRequest 请求参数对象
     */
    public void batchLocationUIByConfirmLocation(ConfirmLocationNoticeDetailRequest noticeDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.batchLocationUIByConfirmLocation(noticeDetailRequest).compose(RxSchedulers.<BaseInfo<InAndOutBoundLocationBean>>compose(mContext)).subscribe(new BaseObserver<InAndOutBoundLocationBean>() {
            @Override
            public void onSuccess(BaseInfo<InAndOutBoundLocationBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 订单批量定位UI界面：确认定位(订单批量定位)
     * 2.16接口：wms/app/new/asn/position/confirm
     *
     * @param noticeDetailRequest
     */
    public void batchLocationUIConfirmLocationByOrderId(ConfirmLocationNoticeDetailRequest noticeDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.batchLocationUIConfirmLocationByOrderId(noticeDetailRequest).compose(RxSchedulers.<BaseInfo<InAndOutBoundLocationBean>>compose(mContext)).subscribe(new BaseObserver<InAndOutBoundLocationBean>() {
            @Override
            public void onSuccess(BaseInfo<InAndOutBoundLocationBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单批量定位
     * 获取通知单批量定位UI界面的数据
     *
     * @param noticeOrderId 通知单ID
     */
    public void batchLocationNoticeUIByNoticeOrderId(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.batchLocationNoticeUIByNoticeOrderId(noticeOrderId).compose(RxSchedulers.<BaseInfo<List<MaterielPositionInfoBean>>>compose(mContext)).subscribe(new BaseObserver<List<MaterielPositionInfoBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<MaterielPositionInfoBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单批量定位
     * 获取通知单批量定位UI界面的数据
     *
     * @param orderId 订单ID（通知单id为空时）
     */
    public void batchLocationNoticeUIByOrderId(String orderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.batchLocationNoticeUIByOrderId(orderId).compose(RxSchedulers.<BaseInfo<List<MaterielPositionInfoBean>>>compose(mContext)).subscribe(new BaseObserver<List<MaterielPositionInfoBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<MaterielPositionInfoBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单批量作业
     * 获取通知单批量作业UI界面的数据
     * 订单批量作业
     * 获取订单批量作业UI界面的数据
     *
     * @param paramId    通知单ID或者订单ID
     * @param isNoticeUI 是否是通知单批量作业界面：true--是；false--订单批量作业界面
     */
    public void batchWorkByNoticeUIOrOrderUI(String paramId, boolean isNoticeUI) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        if (isNoticeUI) {
            mApiService.batchWorkByNoticeUI(paramId).compose(RxSchedulers.<BaseInfo<List<MaterielBatchWorkBean>>>compose(mContext)).subscribe(new BaseObserver<List<MaterielBatchWorkBean>>() {
                @Override
                public void onSuccess(BaseInfo<List<MaterielBatchWorkBean>> baseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(baseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        } else {
            mApiService.batchWorkByOrderUI(paramId).compose(RxSchedulers.<BaseInfo<List<MaterielBatchWorkBean>>>compose(mContext)).subscribe(new BaseObserver<List<MaterielBatchWorkBean>>() {
                @Override
                public void onSuccess(BaseInfo<List<MaterielBatchWorkBean>> baseInfo) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onSuccess(baseInfo);
                    }
                }

                @Override
                public void onFailure(String msg) {
                    if (mHttpResponseCallBackListener != null) {
                        mHttpResponseCallBackListener.onFailure(msg);
                    }
                }
            });
        }
    }

    /**
     * 确认作业(通知单批量定位)
     * 通知单批量作业界面：确认作业按钮接口请求
     *
     * @param listBeans 请求参数对象
     */
    public void batchWorkUIByConfirmWork(List<BaseItemBean> listBeans) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.batchWorkUIByConfirmWork(listBeans).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单出入库详情：
     * 保存作业（未作业）
     *
     * @param saveWorkNoticeBoundDetailRequest
     */
    public void saveWorkNoticeBoundDetailInBound(SaveWorkNoticeBoundDetailRequest saveWorkNoticeBoundDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveWorkNoticeBoundDetailInBound(saveWorkNoticeBoundDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo<BaseInfo> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 通知单出出库详情：
     * 保存作业（未作业）
     *
     * @param saveWorkNoticeBoundDetailRequest
     */
    public void saveWorkNoticeBoundDetailOutBound(SaveWorkNoticeBoundDetailRequest saveWorkNoticeBoundDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveWorkNoticeBoundDetailOutBound(saveWorkNoticeBoundDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 登录
     *
     * @param username
     * @param password
     */
    public void tryLogin(String username, String password) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.tryLogin(username, password).
                subscribeOn(Schedulers.io()).
                observeOn(AndroidSchedulers.mainThread()).
                subscribe(new LoginObserver() {
                    @Override
                    protected void onSuccess(LoginResponse t) {
                        if (mHttpResponseCallBackListener != null) {
                            BaseInfo<LoginResponse> baseInfo = new BaseInfo<>();
                            baseInfo.setData(t);
                            mHttpResponseCallBackListener.onSuccess(baseInfo);
                        }
                    }

                    @Override
                    protected void onFailure(String msg) {
                        if (mHttpResponseCallBackListener != null && !StringUtils.isEmpty(msg)) {
                            mHttpResponseCallBackListener.onFailure(msg);
                        }
                    }
                });
    }

    public interface HttpResponseCallBackListener {
        void onSuccess(BaseInfo<?> baseInfo);

        void onFailure(String message);
    }

    public void setHttpResponseCallBackListener(HttpResponseCallBackListener httpResponseCallBackListener) {
        this.mHttpResponseCallBackListener = httpResponseCallBackListener;
    }

    /**
     * 库存查询
     *
     * @param searchStockRequest
     */
    public void searchStockData(SearchStockRequest searchStockRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.searchStock(searchStockRequest).//
                compose(RxSchedulers.<BaseInfo<List<SearchStockBean>>>compose(mContext)).//
                subscribe(new BaseObserver<SearchStockBean>() {
            @Override
            public void onSuccess(BaseInfo<SearchStockBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 获取移库收货通知单列表
     */
    public void getTransGoodsList(TransGoodsRequest transGoodsRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getTransGoodsList(transGoodsRequest, "1", HttpManger.PAGE_SIZE).//
                compose(RxSchedulers.<BaseInfo<List<TransGoodsBean>>>compose(mContext)).//
                subscribe(new BaseObserver<List<TransGoodsBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<TransGoodsBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 获取移库收货通知单列表
     */
    public void getCheckMangerList(CheckManagerRequest checkManagerRequest, String pageNum) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getCheckManagerList(checkManagerRequest, pageNum, HttpManger.PAGE_SIZE).//
                compose(RxSchedulers.<BaseInfo<List<CheckManagerBean>>>compose(mContext)).//
                subscribe(new BaseObserver<List<CheckManagerBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<CheckManagerBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }


    /**
     * 移库发货详情
     *
     * @param orderId
     */
    public void getMoveHouseSendGoodsOrderDetail(String orderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.moveHouseSendGoodsOrderDetail(orderId).
                compose(RxSchedulers.<BaseInfo<MoveDetailBean>>compose(mContext)).subscribe(new BaseObserver<MoveDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<MoveDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }


    /**
     * 移库发货详情：
     * 保存作业（未作业）
     *
     * @param saveJobInfoDetailRequest
     */
    public void saveNotJobInfo(SaveJobInfoDetailRequest saveJobInfoDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveNotJobInfo(saveJobInfoDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库发货详情：
     * 保存作业（已作业）
     *
     * @param saveJobInfoDetailRequest
     */
    public void saveHasJobInfo(SaveJobInfoDetailRequest saveJobInfoDetailRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveHasJobInfo(saveJobInfoDetailRequest).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }



    /**
     * 移库收货详情：
     * 保存作业（未作业）
     *
     * @param saveTransferGoodsRequest
     */
    public void saveTransferGoodsNotJobInfos(SaveTransferGoodsRequest saveTransferGoodsRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveTransferGoodsNotJobInfo(saveTransferGoodsRequest).compose(RxSchedulers.<BaseInfo<InAndOutBoundLocationBean>>compose(mContext)).subscribe(new BaseObserver<InAndOutBoundLocationBean>() {
            @Override
            public void onSuccess(BaseInfo<InAndOutBoundLocationBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库收货详情：
     * 保存作业（未作业）
     *
     * @param saveTransferGoodsRequest
     */
    public void saveTransferGoodsHasJobInfos(SaveTransferGoodsRequest saveTransferGoodsRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveTransferGoodsHasJobInfo(saveTransferGoodsRequest).compose(RxSchedulers.<BaseInfo<InAndOutBoundLocationBean>>compose(mContext)).subscribe(new BaseObserver<InAndOutBoundLocationBean>() {
            @Override
            public void onSuccess(BaseInfo<InAndOutBoundLocationBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库发货详情：
     * 删除作业(未作业、已作业)
     *
     * @param ids
     */
    public void deleteWorks(String ids) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.deleteWorks(ids).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库收货详情：
     * 删除作业(未作业、已作业)
     *
     * @param ids
     */
    public void deleteTansferGoodsWorks(String ids) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.deleteTansferGoods(ids).compose(RxSchedulers.<BaseInfo>compose(mContext)).subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }


    /**
     * 获取盘点明细
     */
    public void loadCheckDetails(String checkId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.loadCheckDetail(checkId).//
                compose(RxSchedulers.<BaseInfo<List<CheckDetailBean>>>compose(mContext)).//
                subscribe(new BaseObserver<List<CheckDetailBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<CheckDetailBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库收货确认通知单列表
     */
    public void getChangeAndGetList(ChangeHouseConfirmRequest changeAndGetRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getChangeAndGetGoodsNotifyList(changeAndGetRequest, "1", HttpManger.PAGE_SIZE).//
                compose(RxSchedulers.<BaseInfo<List<ChangeHouseConfirmBean>>>compose(mContext)).//
                subscribe(new BaseObserver<List<ChangeHouseConfirmBean>>() {
            @Override
            public void onSuccess(BaseInfo<List<ChangeHouseConfirmBean>> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库收货详情确认通知单
     */
    public void getConfirmDetails(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getConfirmDetails(noticeOrderId).//
                compose(RxSchedulers.<BaseInfo<ChangeHouseConfirmDetailBean>>compose(mContext)).//
                subscribe(new BaseObserver<ChangeHouseConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo<ChangeHouseConfirmDetailBean> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 保存库位转移信息
     */
    public void saveChangeLbs(SaveChangeCuLbs saveChangeCuLbs) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveChangeCuLbs(saveChangeCuLbs).//
                compose(RxSchedulers.<BaseInfo>compose(mContext)).//
                subscribe(new BaseObserver<ChangeHouseConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 保存属性转移信息
     */
    public void saveAttriChange(AttriChangeRequest attriChangeRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveAttriChange(attriChangeRequest).//
                compose(RxSchedulers.<BaseInfo>compose(mContext)).//
                subscribe(new BaseObserver<BaseInfo>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 保存在库整理
     */
    public void inStorageInfo(InStorageRequest inStorageRequest) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.inSorageInfo(inStorageRequest).//
                compose(RxSchedulers.<BaseInfo>compose(mContext)).//
                subscribe(new BaseObserver<ChangeHouseConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 移库收货详情
     */
    public void getTransferDetails(String noticeOrderId) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.getTransferDetails(noticeOrderId).//
                compose(RxSchedulers.<BaseInfo<TransferDetails>>compose(mContext)).//
                subscribe(new BaseObserver<TransferDetails>() {
            @Override
            public void onSuccess(BaseInfo<TransferDetails> baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

    /**
     * 保存盘点
     */
    public void saveStockTaking(SaveStockTakingRequest request) {
        ApiService mApiService = HttpMethod.getInstance().create(ApiService.class);
        mApiService.saveStockTaking(request).//
                compose(RxSchedulers.<BaseInfo>compose(mContext)).//
                subscribe(new BaseObserver<ChangeHouseConfirmDetailBean>() {
            @Override
            public void onSuccess(BaseInfo baseInfo) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onSuccess(baseInfo);
                }
            }

            @Override
            public void onFailure(String msg) {
                if (mHttpResponseCallBackListener != null) {
                    mHttpResponseCallBackListener.onFailure(msg);
                }
            }
        });
    }

}
